from time import sleep

import pytest
from selenium import webdriver
from selenium.webdriver.common.by import By


class TestCase():
    @pytest.fixture(scope='function',autouse=True)
    def setup_teardown(self):
        self.driver = webdriver.Chrome()
        yield
        self.driver.quit()
    def test_a3mall_case_01(self):
        self.driver.get('http://10.59.9.12:7001/')
        self.driver.find_element(By.XPATH,'//a[@href="/home/login.html"]').click()
        dy1=self.driver.find_element(By.CLASS_NAME,'reg-new').text
        assert '会员登录'==dy1
        self.driver.find_element(By.XPATH,'//input[@type="text" and @name="username"]').send_keys('xiaoma')
        self.driver.find_element(By.XPATH,'//input[@name="password" or @placeholder="请输入密码"]').send_keys('khl131488')
        sleep(10)
        self.driver.find_element(By.XPATH,'//div[@class="finish-registration"]/a').click()
        sleep(5)
        dy2=self.driver.find_element(By.XPATH,'/html/body/div[5]/div[2]/div[1]/div[2]/div[2]/ul/li[1]').text
        dy2_text='您好，xiaoma 欢迎回来！上一次登录时间'
        assert  dy2_text in dy2